package com.shuiyun.cloud.controller;

import com.alibaba.fastjson.JSON;
import com.shuiyun.cloud.UserService;
import com.shuiyun.cloud.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController
@Api(tags = "对外暴露接口")
@RequestMapping("tk")
public class ApiController {

    @Autowired
    private UserService userService;

    @GetMapping("/test")
    @ApiOperation("测试接口")
    public String test(){
        return "tk is ok";
    }

    @GetMapping("/test2")
    @ApiOperation("测试接口-连接数据库")
    public String test2(){
        List<User> all = userService.findAll();
        return JSON.toJSONString(all);
    }


}
